"use strict"
let sendStat = require("../extend/helper").sendStat
module.exports = () => {
	/**
   * @type {import("egg").CbMiddle } ctx
   */
	async function Auth(ctx, next) {
		if (ctx.session.adminUser) {
			await next()
			return
		}
		else {
			ctx.status = 401
			ctx.body = sendStat(ctx.app.config.constant.ERROR_PERMISS_NOT_ALLOWED, "未授权")
			return
		}
	}
	return Auth
}